<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- AUTHOR: JOEY -->
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      >
    <body>
        <ui:composition>
            <h:form>
                        <p:outputPanel>
                            <p:remoteCommand name="updateStudent" update="@form"/>
                            <h:panelGrid id="studentGrid" columns="3">
                                <h:outputText value="Select students to remove. CAUTION: Students will be removed permanently from the system. " />
                                <h:outputText value="You can change student email and major and enable/disable login." />
                                <p:commandButton value="Save Changes" process="@form" update=":tabForm:growl" oncomplete="updateStudent();" action="#{manageAccountBean.updateStudents}"/>

                                <h:selectManyListbox id="students" size = "10" value="#{manageAccountBean.selectedItems}">
                                    <f:selectItems value="#{manageAccountBean.selectItems}"/>
                                </h:selectManyListbox>
                                <p:fieldset legend="Student Account Information"> 
                                <p:dataTable id="studentTable" value="#{manageAccountBean.manageAccount}" var="student">
                                    <p:column headerText="username">
                                        <h:outputText value="#{student.username}" />
                                    </p:column>
                                    <p:column headerText="firstname">
                                        <h:outputText value="#{student.firstname}" />
                                    </p:column>
                                    <p:column headerText="lastname">
                                        <h:outputText value="#{student.lastname}" />
                                    </p:column>
                                    <p:column headerText="email">
                                        <p:inputText value="#{student.email}"  />
                                    </p:column>
                                    <p:column headerText="major">
                                        <p:inputText value="#{student.major}"  />
                                    </p:column>
                                </p:dataTable>
                            </p:fieldset>
                                <h:outputText value="" />
                                <p:commandButton value="Remove" process="@form" update=":tabForm:growl" oncomplete="updateStudent();" action="#{manageAccountBean.removeStudent}" />
                                <h:outputText value="" />
                                <h:outputText value="" />
                                <h:outputText value="After all students are removed, an instructor can remove the instructor's account from the system." />
                                <h:outputText value="" />
                                <h:outputText value="" />
                                <p:commandButton value="Remove Myself" process="@form" update=":tabForm:growl" oncomplete="updateStudent();" action="#{manageAccountBean.removeInstructor}" />
                            </h:panelGrid>                      
                        </p:outputPanel>
            </h:form>
        </ui:composition>
    </body>
</html>